function create_project()
{
    project=$1
        trac_path=/var/www/trac/
        if [ -e $trac_path/$project ]; then
            echo "project "$project"already exists"
        return
        fi

        trac-admin $trac_path/$project initenv --inherit=/var/www/trac/trac.ini

        chown -R apache:apache  $trac_path/$project

        trac-admin $trac_path/$project permission add admin TRAC_ADMIN
        trac-admin $trac_path/$project permission remove anonymous '*'
        trac-admin $trac_path/$project permission add develop LOG_VIEW FILE_VIEW EMAIL_VIEW MILESTONE_ADMIN MILESTONE_MODIFY MILESTONE_CREATE MILESTONE_VIEW WIKI_VIEW WIKI_CREATE WIKI_MODIFY SEARCH_VIEW REPORT_VIEW REPORT_SQL_VIEW REPORT_CREATE REPORT_MODIFY
        trac-admin $trac_path/$project permission add develop TICKET_VIEW TICKET_CREATE TICKET_MODIFY BROWSER_VIEW TIMELINE_VIEW CHANGESET_VIEW ROADMAP_ADMIN TICKET_EDIT_CC

        trac-admin $trac_path/$project permission add test LOG_VIEW FILE_VIEW WIKI_VIEW WIKI_CREATE WIKI_MODIFY SEARCH_VIEW REPORT_VIEW REPORT_SQL_VIEW

        trac-admin $trac_path/$project permission add liuguirong admin
        trac-admin $trac_path/$project permission add wanjiamei test
        trac-admin $trac_path/$project permission add hanfeng develop

        trac-admin $trac_path/$project deploy /tmp/deploy
        mv /tmp/deploy/* $trac_path/$project

        echo "WSGIScriptAlias /trac/$project $trac_path/$project/cgi-bin/trac.wsgi" >> /etc/httpd/conf/httpd.conf

        service httpd restart
}

if [ $# -eq 1 ]; then
     echo $@
     create_project $1
else
     echo "usage is "$0" project_name"
fi

